package com.example.basic.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        // 配置：访问 "/icon/**" 时，映射到 classpath 下的 "/icon/" 目录
        registry.addResourceHandler("/icon/**")  // 前端访问的路径前缀
                .addResourceLocations("classpath:/icon/");  // 资源在项目中的实际路径（classpath 即 resources 目录）
    }
}